home *** CD-ROM | disk | FTP | other *** search
/ Aminet 45 / Aminet 45 (2001)(GTI - Schatztruhe)[!][Oct 2001].iso / Aminet / game / role / ldmud-3.2-bin.lha / mud / doc / efun / set_bit < prev    next >
Text File  |  2001-04-06  |  1KB  |  31 lines

  1. SYNOPSIS
  2.         string set_bit(string str, int n)
  3.  
  4. DESCRIPTION
  5.         Return the new string where bit n is set in string str. Note
  6.         that the old string str is not modified.
  7.         
  8.         Each character contains 6 bits. So you can store a value
  9.         between 0 and 63 in one character (2^6=64). Starting character
  10.         is the blank " " which has the value 0. The first charcter in
  11.         the string is the one with the lowest bits (0-5).
  12.         
  13.         The new string will automatically be extended if needed.
  14.  
  15. EXAMPLES
  16.         string s;
  17.         s=set_bit("?",5);
  18.         
  19.         Because "?" has a value of 31 the variable s will now contain
  20.         the character "_" wich is equal to 63 (31+2^5=63).
  21.         
  22.         string s;
  23.         s=set_bit("78",3);
  24.         s=set_bit(s,8);
  25.         
  26.         s will now contain the string "?<".
  27.         
  28. SEE ALSO
  29.         clear_bit(E), last_bit(E), next_bit(E), test_bit(E), count_bits(E),
  30.         and_bits(E), or_bits(E), xor_bits(E), invert_bits(E)
  31.